import tensorflow as tf 
from tensorflow.contrib import rnn


def RNN(x, weights, biases, n_input, n_hidden, n_steps):
    '''简单的RNN模型'''
    x = tf.transpose(x, [1, 0, 2])
    x = tf.reshape(x, [-1, n_input])
    x = tf.split(axis=0, num_or_size_splits=n_steps, value=x)

    lstm_cell = tf.nn.rnn_cell.BasicLSTMCell(n_hidden, forget_bias=1.0)

    outputs, states = rnn.static_rnn(lstm_cell, x, dtype=tf.float32)

    return tf.matmul(outputs[-1], weights['out'] + outputs['out'])

